import {Component} from "@angular/core";
import {AwardService} from "../svrs/award.service";
import {Award} from "../svrs/domain";
import {ActivatedRoute, Router} from "@angular/router";
import {DialogService} from "ngx-weui";

@Component({
  selector: 'zm-index',
  templateUrl: './index.component.html',
  styleUrls: ['./index.component.css']
})

export class IndexComponent{
  index;
  awards:Award[];
  config:any={
    type:'prompt',
    title:'电话'
  }
  constructor(private svr:AwardService,private aRouter:ActivatedRoute,private dialogSvr:DialogService) {
    //this.awards=this.svr.getawards();
    aRouter.params.subscribe(pars=>{
      if(pars && pars.awardId1){
        this.index=parseInt(pars.awardId1)-1;
      }
    })

    this.svr.getawards().subscribe(
      (data) => {
        this.awards = data;
      }
    )
  }
  dialogSvrShow(){
    this.dialogSvr.show(this.config).subscribe(bao=>{

    })
  }
}
